
#include "FileUtils.h"
#include <iosfwd>
#include <xiosbase>

static FileUtils* s_file = nullptr;
FileUtils* FileUtils::getInstance()
{
	if (s_file == nullptr)
	{
		s_file = new FileUtils();
	}
	return s_file;
}

void FileUtils::releaseInstance()
{
	SAFE_DELETE(s_file);
}

bool FileUtils::getStringWithFileName(const std::string& fileName, std::string* buffers)
{
	std::ifstream ifs(fileName, std::ifstream::in);
	if (!ifs.is_open()) return false;
	*buffers = std::string(std::istreambuf_iterator<char>(ifs), std::istreambuf_iterator<char>());
	ifs.close();
	return !ifs.bad();
}